from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column,String,TEXT,Integer


#首先生成 orm基类
Base = declarative_base()

class Detail(Base):
    """
    需要继承基类才能继续去定义
    """
    __tablename__ = "sql_test"

    id = Column(Integer,primary_key=True)
    title = Column(String(50))
    content = Column(TEXT())


if __name__ == "__main__":
    engine = create_engine("mysql+pymysql://root:tusbasa1@127.0.0.1/scrapy_test1", encoding="utf-8")
    Base.metadata.create_all(engine)  # 创建表结构
